<script lang="ts" setup>
import { queryCategoryList } from '@/api/category'
import { onMounted, ref } from 'vue'
// 加载树
const data = ref([])
const loadCategory = async () => {
  let result = await queryCategoryList()
  console.log(result)
  data.value = result.data
}

// 引入树组件
const defaultProps = {
  children: 'children',
  label: 'name',
}
const handleNodeClick = () => { }

// 预加载
onMounted(() => {
  loadCategory()
})
</script>
<template>
  <el-tree style="width: 300px" :data="data" :props="defaultProps" @node-click="handleNodeClick" />
</template>
<style scoped>

</style>